package chapter12;

/**
 * Created by Caesar on 2016/1/6.
 */

class GrandPaException extends Exception {
}

class FatherException extends GrandPaException {
}

class SonException extends FatherException {
}

class A {
    void throwE() throws GrandPaException {
        throw new GrandPaException();
    }
}

class B extends A {
    void throwE() throws FatherException {
        throw new FatherException();
    }
}

class C extends B {
    void throwE() throws SonException {
        throw new SonException();
    }
}


public class EX25 {
    public static void main(String[] args) {
        A a = new C();
        try {
            a.throwE();
        } catch (GrandPaException e) {
            e.printStackTrace();
        }
    }
}







